package com.bit.ioc.component;

import com.bit.ioc.model.UserInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component("userComponent2")
public class UserComponent {
    public void  hello(){
        System.out.println("hello, UserComponent...");
    }


    @Bean({"userInfo1", "u1"})
    public UserInfo userInfo(){
        return new UserInfo("zhangsan",18);
    }

//    @Primary
    @Bean
    public UserInfo userInfo2(){
        return new UserInfo("lisi",14);
    }
}
